﻿using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DynamicQuartz.Common.Configuration
{
    public static class ConfigurationHelper
    {
        private static IConfiguration _configuration;

        // 在应用程序启动时进行初始化
        public static void Initialize(IConfiguration configuration)
        {
            _configuration = configuration;
        }

        // 添加您需要的其他静态方法来访问配置
        public static string GetSection(string name)
        {
            return _configuration.GetSection(name).Value ?? throw new Exception($"未配置{name}");
        }
        public static void Bind(string name, object? instance)
        {
            _configuration.GetSection(name).Bind(instance);
        }
    }
}
